package main

import (
	"github.com/hashicorp/consul/api"
	"log"
)

func main() {
	consulConfig := api.DefaultConfig()
	consulClient, err := api.NewClient(consulConfig)
	if err != nil {
		log.Println("创建 consul 对象失败:", err)
	}

	err = consulClient.Agent().ServiceDeregister("my_consul_id")
	if err != nil {
		log.Println("注销失败:", err)
		return
	}

	log.Println("注销失成", err)
}
